home *** CD-ROM | disk | FTP | other *** search
- ===========================================================================
- BBS: The Abacus * HST/DS * Potterville MI
- Date: 03-10-93 (14:07) Number: 108
- From: TOMAS HOOD Refer#: NONE
- To: ALL Recvd: NO
- Subj: MSC 6.00a Conf: (36) C Language
- ---------------------------------------------------------------------------
- Hello, All!
-
- I know.. MSC 6.00a is old. But, until I can make enough to upgrade...
-
- I have a question:
-
- Here is some code I wrote...
-
- (EXAMPLE)
-
-
- void do_something(int *);
- void main(void);
-
- void main(void) {
-
- int i;
- int loop;
-
- i = 0;
-
- for (loop=0; loop < 15; loop++) {
-
- do_something(&i);
-
- }
-
- exit(0);
- }
-
- void do_something(int *j) {
-
- printf("the int 'i' is passed as: %d \n", *j);
- *j++;
-
- }
-
- (END)
-
- After compiling with MSC 6.00a, I get results that indicate that *j++ did NOT in
- crement the value. It stayed as is. I had to re-write it:
-
- (REDO)
-
- void do_something(int *j) {
-
- printf("the int 'i' is passed as: %d \n, *j);
- *j = *j + 1;
-
- }
-
- (END OF REDO)
-
- Does anyone know why? Is it standard, i.e., am I thinking about pointers and va
- lues in the wrong way? Is the *j++ syntax not proper?
-
- Perhaps it is due to optimizing. Let me know what you know ...
-
- thanks!
-
- tomas hood (------------------------------
- | at 14:07,
- CIS 71664,3726 | on Wednesday March 10 1993,
- Fido 1:352/777 | in Olympia, Washington USA
- ICDMnet 77:1/0 ------------------------------)
-
-
- --- GEcho 1.00/beta+
- * Origin: the ICDMnet IHQ, Olympia WA USA (1:352/777)
- SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
- SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 239/1004
- SEEN-BY: 280/1 390/1 396/1 5 15 730/6 2270/1 3603/20
-